package top.javahai.subtlechat.init.service.impl;

import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import top.javahai.subtlechat.api.pojo.Parameters;
import top.javahai.subtlechat.init.dao.ParametersDao;
import top.javahai.subtlechat.init.service.ParametersService;

/**
 * @author Qiangfanghao
 */
@Service("parametersService")
public class ParametersServiceImpl implements ParametersService {

    private final Logger log = LoggerFactory.getLogger(getClass());

    @Autowired
    private ParametersDao parametersDao;


    @Override
    public Parameters findOne(String id) {
        if (StringUtils.isNotBlank(id)){
            return parametersDao.findOne(id);
        }
        return null;
    }

    @Override
    public Parameters findOneByName(String name) {
        if ( StringUtils.isNotBlank(name)) {
            return parametersDao.findOneByName(name);
        }
        return null;
    }


    @Override
    public void save(Parameters parameters) {
        parametersDao.save(parameters);
    }
}
